Skip to content

routefinder: name loc approach bits, add rotation tests - #156

Open
reldo-dev wants to merge 1 commit into
OpenRune:mainfrom
reldo-dev:pr/loc-approach-mask
Open

routefinder: name loc approach bits, add rotation tests#156
reldo-dev wants to merge 1 commit into
OpenRune:mainfrom
reldo-dev:pr/loc-approach-mask

Conversation

@reldo-dev

Copy link
Copy Markdown

Follow-up to #123. No behaviour change.

Rotations.rotate masks to 4 bits (7cd2d93). The mask is right — this makes the reason explicit and adds tests.

forceApproachFlags is a 5-bit mask. Every non-zero value at rev 240 is 0b11111 with exactly one bit cleared — the permitted approach:

value binary permitted locs
0x1e 11110 north 759
0x1d 11101 east 535
0x1b 11011 south 1412
0x17 10111 west 226
0x0f 01111 bit 4 59

Bits 0–3 are N/E/S/W. Bit 4 is a fifth position, used only by 59 locs — all 1×1 and non-solid. Not modelled server-side.

Why only north broke: unmasked, 0x1e shr 3 wraps two bits instead of one and gives 0x0f — every side blocked. The other three land the stray bit where the shift already set one.

Adds the first tests to engine/routefinder, covering every value in the cache across all four angles.

Rotations.rotate masks its input to 4 bits (7cd2d93). The mask is correct
but hides the reason: forceApproachFlags is a 5-bit mask, not 4.

Every non-zero value in the rev 240 cache is 0b11111 with exactly one bit
cleared - the single permitted approach. Bits 0-3 are N/E/S/W; bit 4 is a
fifth position used by 59 locs and unmodelled server-side.

Unmasked, only 0x1e broke: its stray bit wraps into the low nibble giving
0x0f, blocking every side. The other three rotate correctly by coincidence.

No behaviour change.
@reldo-dev reldo-dev mentioned this pull request Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant